package cn.com.czpb.client.module.news.view;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import cn.com.czpb.client.R;

/**
 * Created by 猪猪侠 on 2017/8/25.
 */

public class TopImageView {
    private Activity mActivity;
    private String url;
    private View root;

    public static TopImageView instance(Activity activity,String url){
        return  new TopImageView(activity,url);
    }

    public TopImageView(Activity activity, String url) {
        this.mActivity = activity;
        this.url = url;
        initView();
    }
    public View getView(){
        return root;
    }

    private void initView() {
        root = mActivity.getLayoutInflater().inflate(R.layout.view_image,null);
        ImageView imageView = root.findViewById(R.id.iv_id);
        Glide.with(mActivity).load(url).crossFade().placeholder(R.drawable.default_bg).into(imageView);
    }


}
